from django.contrib import admin

from app.admin import FormBaseConfig

from . import models
from .resources import ToDoResource, ToDoTagsResource


@admin.register(models.TodoList)
class TodoListAdmin(FormBaseConfig):
    resource_class = ToDoResource
    list_display = ('id', 'name', 'active', 'tag_ids', 'created_by',
                    'updated_by', 'created_at', 'updated_at')
    list_display_links = ('id', 'name', 'tag_ids')
    list_filter = ('active',)
    search_fields = ('name',)
    list_per_page = 10
    list_max_show_all = 100


@admin.register(models.ToDoTags)
class ToDoTagsAdmin(FormBaseConfig):
    resource_class = ToDoTagsResource
    list_display = ('id', 'name', 'active', 'created_by',
                    'updated_by', 'created_at', 'updated_at')
    list_display_links = ('id', 'name')
    list_filter = ('active',)
    search_fields = ('name',)
    list_per_page = 10
    list_max_show_all = 100
